package com.admin.service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.admin.bean.ProvinceBean;

public class ProvinceService {

	static List<ProvinceBean> list = new ArrayList<ProvinceBean>();
	
	static Map<Integer,String> bussiness = new HashMap<Integer,String>();
	
	static {
		list.add(new ProvinceBean(2,"北京"));
		list.add(new ProvinceBean(3,"天津"));
		list.add(new ProvinceBean(4,"河北"));
		list.add(new ProvinceBean(5,"山西"));
		list.add(new ProvinceBean(6,"内蒙古"));
		list.add(new ProvinceBean(7,"辽宁"));
		list.add(new ProvinceBean(8,"吉林"));
		list.add(new ProvinceBean(9,"黑龙江"));
		list.add(new ProvinceBean(10,"上海"));
		list.add(new ProvinceBean(11,"江苏"));
		list.add(new ProvinceBean(12,"浙江"));
		list.add(new ProvinceBean(13,"安徽"));
		list.add(new ProvinceBean(14,"福建"));
		list.add(new ProvinceBean(15,"江西"));
		list.add(new ProvinceBean(16,"山东"));
		list.add(new ProvinceBean(17,"河南"));
		list.add(new ProvinceBean(18,"湖北"));
		list.add(new ProvinceBean(19,"湖南"));
		list.add(new ProvinceBean(20,"广东"));
		list.add(new ProvinceBean(21,"广西"));
		list.add(new ProvinceBean(22,"海南"));
		list.add(new ProvinceBean(23,"重庆"));
		list.add(new ProvinceBean(24,"四川"));
		list.add(new ProvinceBean(25,"贵州"));
		list.add(new ProvinceBean(26,"云南"));
		list.add(new ProvinceBean(27,"西藏"));
		list.add(new ProvinceBean(28,"陕西"));
		list.add(new ProvinceBean(29,"甘肃"));
		list.add(new ProvinceBean(30,"青海"));
		list.add(new ProvinceBean(31,"宁夏"));
		list.add(new ProvinceBean(32,"新疆"));
		list.add(new ProvinceBean(33,"台湾"));
		list.add(new ProvinceBean(34,"香港"));
		list.add(new ProvinceBean(35,"澳门"));
		
		bussiness.put(1, "SMS");
		bussiness.put(2, "MMS");
		bussiness.put(3, "IVR");
		bussiness.put(4, "视频基地");
		bussiness.put(5, "百宝箱游戏");
		bussiness.put(6, "G+游戏");
		bussiness.put(7, "动漫基地");
		bussiness.put(8, "阅读基地");
		bussiness.put(9, "MM基地");
		bussiness.put(10, "MDO业务");
	}
	
	public static List<ProvinceBean> getProvinceList(){
		return list;
	}
	
	public static ProvinceBean getProvince(int id) {
		if(id <= 0) {
			return new ProvinceBean(0,"不详");
		}
		for (ProvinceBean bean : list) {
			if(bean.getId()==id) {
				return bean;
			}
		}
		
		return null;
	}
	
	public static ProvinceBean getProvince(String province) {
		for (ProvinceBean bean : list) {
			if(bean.getProvince().equals(province) || bean.getProvince().startsWith(province)) {
				return bean;
			}
		}
		return null;
	}
	
	public static String getBussiness(int id) {
		return bussiness.get(id);
	}
	
}
